<template>
  <div class="page-nav">
    <el-row>
      <el-col :span="24">
        <h3 class="logo"><router-link to='/'>小U商城后台</router-link></h3>
        <!-- default-active="1"默认激活的菜单 -->
        <!-- router开启路由模式（默认不开启），以 index 作为 path 进行路由跳转 -->
        <!-- unique-opened：是否只保持一个子菜单的展开 -->
        <el-menu
          unique-opened
          :default-active="$route.path"
          class="el-menu-vertical-demo"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
          router
        >
          <el-menu-item index="/">
            <i class="el-icon-setting"></i>
            <span slot="title">首页</span>
          </el-menu-item>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-setting"></i>
              <span>系统设置</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/menu">菜单管理</el-menu-item>
              <el-menu-item index="/role">角色管理</el-menu-item>
              <el-menu-item index="/admin">管理员管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>商城管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item
                v-for="(item, index) in menuList"
                :key="index"
                :index="item.path"
              >{{item.title}}</el-menu-item>
            </el-menu-item-group>
          </el-submenu>       
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      menuList: [
        {title: '商品分类', path: '/category'},
        {title: '商品规格', path: '/specs'},
        {title: '商品管理', path: '/goods'},
        {title: '会员管理', path: '/member'},
      ]
    }
  },
  methods: {
      
    }
};
</script>

<style>
.page-nav{
    height: 100vh;
    background-color: #262a32;
    overflow: hidden;
}
.page-nav .el-menu{
    border-right: 0;
}
.page-nav h3{
  line-height: 60px;
  text-align: center;
  font-size: 20px;
  color: #fff;
  background-color: #444;
  white-space: nowrap;
  overflow: hidden;
  font-weight: normal;
  letter-spacing: 3px;
}
.page-nav h3 a{
  color: #fff;
  text-decoration: none;
}
.el-menu-vertical-demo {
  text-align: left;
}
.el-menu-item.is-active {
  background-color: #FB6D49!important;
  color: #fff!important;
}
.el-menu-item.is-active i {
  color: #fff;
}
.el-menu-item.is-active span {
  color: #fff;
}
</style>